﻿package
{
	import core.Model;
	import core.manager.SoundManager;
	
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	
	public class InsureHintPanel extends MovieClip
	{
		public var yesBtn:SimpleButton;
		
		public var noBtn:SimpleButton;
		
		public var everBtn:SimpleButton;
		
		public function InsureHintPanel()
		{
			super();
			this.addEventListener(MouseEvent.CLICK,setHintHandler);
			SoundManager.instance.play("errorMessage");
		}
		
		private function setHintHandler(event:MouseEvent):void {
			var target:* = event.target;
			var doActionabled:Boolean = true;
			if(target == yesBtn){
				Model.instance.hintMode = 1;
			}else if(target == noBtn){
				Model.instance.hintMode = 0;
			}else if(target == everBtn) {
				Model.instance.hintMode = -1;
			}else {
				doActionabled = false;
			}
			
			if(doActionabled){
				if(callback != null){
					this.callback.apply(null,[false]);
				}
			}
			this.dispose();
			
		}
		
		public var callback:Function;
		
		public function dispose():void {
			this.callback = null;
			if(this.parent){
				this.parent.removeChild(this);
			}
		}
	}
}